The present invention relates to an optical character reader designed to read characters, symbols and the like (hereinafter referred to collectively as characters) on a sheet of paper by scanning the sheet with a portable scanner.
POS (Point of Sales) systems have become widely used in which sales data for each individual article is collected and used for inventory control purposes, etc., in supermarkets, department stores and the like. In many cases, portable optical character readers are used in POS systems.
An optical character reader of the same general type to which the invention pertains is described in commonly assigned Japanese Laid-Open Patent Publication No. 61-41474 (1986) and in shown in FIG. 1 herein. In FIG. 1, reference numeral 1 denotes a scanner arranged such that characters recorded on a sheet of paper 3 are read by holding the scanner 1 with the hand 2 and placing it on the sheet 3. The sheet 3 may be, for example, a price tag on which has been recorded information used in the POS system. Reference numeral 4 denotes a light source, 5 a lens system, and 6 an image sensor which is required to have a field of view which corresponds to at least one line of characters recorded on the sheet 3. In the illustrated example, the visual field has a breadth corresponding to about one line of characters and a length corresponding to about three times the length of one character. A control and binary encoding circuit 7 converts the analog output signal for the image sensor 6 into binary-coded signals which correspond to a character region and a background region, respectively, and delivers the binary-coded signals to a memory 8. In the memory 8 are stored binary-coded signals obtained from the entire visual field of the image sensor 6.
Recognition processing is carried out on the basis of the binary-coded signals stored in the memory 8. In the illustrated example, binary-coded signals concerning characters which are correctly contained in the visual field alone are subjected to recognition processing. More specifically, FIG. 2 shows an example of the scanning and binary encoding operation of the scanner 1. In the case illustrated in FIG. 2, characters are correctly contained in the visual field 17. On the other hand, FIG. 3 shows another example in which the sheet 3 is scanned with the image sensor 6 in such a manner that the characters are out of the visual field 17. In such a case, no recognition processing (described below in detail) is carried out. As the scanner 1 is moved, the sheet 3 is scanned with the image sensor 6 again and the output signals of the image sensor 6 are converted into binary-coded signals, which are then stored in the memory 8, thereby increasing the reading speed. It should be noted that, in FIGS. 2 and 3, vertical lines which show boundaries between the picture elements ar partially omitted.
Judgment as to whether or not recognition processing should be carried out is made in a field position detecting circuit 9. More specifically, the field position detecting circuit 9 operates parallel to the operation of storing binary-coded signals in the memory 8, and at substantially the same time as the completion of the storing of the binary-coded signals in the memory 8, the field position detecting circuit 9 judges whether or not recognition processing can be carried out. When it is judged that recognition processing can be carried out, the field position detecting circuit 9 determines a region which is to be subjected to recognition. That is, binary-coded signals for the whole visual field are not processed, and only a region including at least one character is subjected to recognition processing.
An example of the arrangement of the field position detecting circuit 9 is shown in FIG. 4. As illustrated, the field position detecting circuit 9 is inclusive of a row-by-row OR circuit 21 inclusive of an OR gate 23 and a register 24 and a judging circuit 22 composed of a ROM 25 and a register 26.
The row-by-row OR circuit 21 performs an OR operation for each row in that region of the visual field of the image sensor 6 which contains picture element in about a third of the visual field at a substantially central portion thereof in the widthwise direction (i.e., from the column B.sub.t to the column B.sub.u in the region 19 of the visual field 17 shown in FIG. 2). More specifically, when binary-coded signals representing information such as shown in FIG. 2 are delivered from the control and binary encoding circuit 7, binary-coded signals corresponding to the picture elements which are disposed at the respective locations, i.e., from the corner of the row L.sub.1 and the column B.sub.1 to the corner of the row L.sub.p and the column B.sub.q, are successively stored in the memory 8, and, at the same time, the logical sum of the binary-coded signals in each row at a section from the column B.sub.t to the column B.sub.u is obtained in the row-by-row OR circuit 21.
More specifically, when, with the register 24 cleared in advance, the signal corresponding to the picture element at the corner of the row L.sub.1 and the column B.sub.t is input to the OR gate 23, the input signal is ORed with the output signal from the register 24, and the result of the OR operation is stored in the register 24. This operation is repeated up to the column B.sub.u, and the result of the OR operation for the row L.sub.1 is eventually stored in the register 24. When the logical sum of the signals from the column B.sub.t to the column B.sub.u is thus obtained, the content of the register 24 is delivered to the judging circuit 22 and, that the same time, the register 24 is cleared. In this way, the results of OR operations for the rows from the row L.sub.1 to the row L.sub.p are successively delivered to the judging circuit 22. From the result of the OR operation performed for each row, it is possible to know whether or not a "dark" binary representation is present in each row.
The following is a description of the arrangement and function of the judging circuit 22, which is supplied with signals representative of the result of the OR operations.
The signal which is representative of the result of the OR operation for each row is input to the ROM 25, and data which is read out from the ROM 25 is stored in the register 26. Since transitions of state which represent changes from light to dark and vice versa have previously been written in the ROM 25 in the form of codes, the light/dark states of the rows up to the row which has just been subjected to the OR operation are stored in the register 26. The signal output from the register 24, which represents the result of the OR operation for the subsequent row, and the signal output from the register 26, which represents the light/dark state of the rows up to the preceding row, are input to the ROM 25 to obtain a signal representative of a new state, which is then stored in the register 26. In the ROM 25 have previously been written codes respectively corresponding to signals SET, END and CLEAR. The signal SET is output when the light/dark state changes from the light state to the dark state, whereas the signal END is output when the light/dark state changes from the dark state t the light state after the light/dark state has been consecutively decided to be dark more than a certain number of times (related to the normal height of the characters). Thus, the character position is detected extending from a row for which the signal SET is output to another row for which the signal END is output. On the other hand, when neither the signal SET nor the signal END is output during the judging operation for the uppermost row L.sub.1 to the lowermost row L.sub.p, the signal CLEAR is output to a control circuit 16, and the memory 8 is cleared by a signal output from the control circuit 16. Thus, no recognition processing is carried out thereafter, but scanning is effected again to take in new binary-coded signals.
The reason why in the above-described example the logical sum for each row is calculated not for the signals concerning all the columns in the visual field but for the signals only in the central region of the visual field is to minimize the effect of noise which may be generated when the sheet 3 is smaller than the visual field or when a black mark is printed on the sheet 3 outside the region of the characters which are to be read. If the light area of the sheet 3 is sufficiently larger than the visual field, it is possible to calculate a logical sum of the signals concerning all the columns in the visual field.
A new-line detecting circuit 10 determines a character position on the basis of the signals SET and END delivered from the field position detecting circuit 9 and further compares the determined character position with a new character position determined on the basis of the signals SET and END obtained by the subsequent scanning to judge whether or not a new line of characters is present on the basis of the rate of change (the number of picture elements which have changed) in the character position, or on the basis of the fact that the character line has once been output of the visual field 17, which fact is detected from the signal CLEAR. When a new character line is judged to be present, the new-line detecting circuit 10 delivers a signal NEW to a recognition processing circuit 15. After the delivery of the signal NEW, the subsequent recognition processing is carried out.
The new-line detecting circuit 10 makes it possible to read a sheet 3 which carries a larger number of lines of characters than the number of lines which can be continued in the visual field simply by moving the scanner 1 vertically, i.e., either downward or upward. More specifically, since the apparatus is arranged to read characters by placing the scanner 1 on the sheet 3, if the scanner 1 remains stationary on the sheet 3 for a long time, the same portion may be scanned many times to read characters. However, the new-line detecting circuit 10 prevents such an undesirable operation.
The operation of separately recognizing each individual character will next be explained.
Since the binary-coded signals stored in the memory 8 concern all the picture elements in the visual field of the image sensor 6, it is necessary to convert them into a group of binary-coded signals for each character, that is, into data concerning a number of picture element which can be processed in the recognition processing circuit 15 which effects recognition of characters one by one.
The following description will be made on the assumption that the number of picture elements which can be processed in the recognition processing circuit 15 is n in the widthwise direction and m in the lengthwise direction as viewed in FIG. 2.
First, to a one-digit buffer 11 are transferred binary-coded signals concerning picture element within the area n.times.p, n being the number of picture elements in the widthwise direction and p being the number of picture elements in the lengthwise direction, that is, all of the picture elements contained in one row. In other words, binary-coded signals concerning the picture elements within the area defined between the rows L.sub.1, L.sub.p and the columns B.sub.1, B.sub.n inclusive are stored in the one-digit buffer 11.
A lengthwise position detecting circuit 12 detects the lengthwise position of one character from the binary-coded signal stored in the one-digit buffer 11 in order to reduce the number of binary-coded signals to the number m of picture elements in the lengthwise direction which can be processed in the recognition processing circuit 15. The lengthwise position of a character is determined in the lengthwise position detecting circuit 12, and m picture elements in the lengthwise direction which can be processed in the recognition processing circuit 15 are chosen (so that the character is located in the substantially central position). Thus, m picture elements in the lengthwise direction are chosen among the binary-coded signals stored in the one-digit buffer 11, and the reduced number of binary-coded signals are transferred to a one-character buffer 14 as data m.times.n concerning one character. In the example shown in FIG. 2, binary-coded signals contained in the area defined between the rows L.sub.1, L.sub.m and the columns B.sub.1, B.sub.n inclusive are transferred to the one-character buffer 14 as being data concerning one character.
A widthwise position detecting circuit 13 determines a widthwise position for binary-coded signals which are to be subsequently stored in the one-digit buffer 11. Each character may be stored in the one-digit buffer 11 by being moved widthwise one picture element position. In such a case, however, the processing time may increase disadvantageously because the same character may be stored many times. Therefore, the widthwise position detecting circuit 13 detects the number of picture elements which are present widthwise between the character concerned and a subsequent character, and the circuit 13 shifts the binary-coded signals by an amount corresponding to the detected number of picture elements to store in the one-digit buffer 11 the binary-coded signals related to the picture elements within the are of n.times.p.
For example, the content of the one-digit buffer 11 may changed as shown in FIGS. 5A to 5C.
The recognition processing circuit 15 recognizes one character at a time on the basis of the binary-coded data stored in the one-character buffer 14. The circuit 15 may have a known arrangement, for example, that described in Japanese Patent Publication No. 59-6418 (1984). More specifically the recognition processing circuit 15 is adapted to extract characteristic data concerning the character constituting portion for each row or column in vertical and horizontal character areas and to output a result of character recognition which corresponds to the type and appearance sequence of the characteristic data.
When a sheet 3 which carries a larger number of lines of characters than the number of lines which can be contained in the visual field is t be read with the prior-art optical character reader, it suffices to move the scanner 1 vertically, i.e., either downward or upward. However, if the speed of movement of the scanner 1 is excessively high, the image of a character sensed by the image sensor 6 may be blurred and it may be impossible to obtain a correct recognition result. A correct recognition result cannot be obtained either when a character is unreadable or when a character is erroneously read (misrecognition). When a character is unreadable, a "reject" code is output from the recognition processing circuit 15 so that the operator becomes aware of this fact immediately. It is therefore only necessary to place the scanner 1 on the sheet 3 again. In the case of misrecognition, however, even if the sheet 3 carries, for example, the character "7", a code representative of, for example, "1", may be output from the recognition processing circuit 15. Therefore, the operator cannot know whether or not the character "7" has been erroneously recognized simply by observing the recognition result from the recognition processing circuit 15. Accordingly in order to obtain a reliable recognition result, the operator must compare the recognition result output from the recognition processing circuit 15 while moving the scanner 1 to confirm that no misrecognition occurs due to an excessively high speed of movement of the scanner 1. This imposes a heavy load on the operator.